﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Item
/// </summary>
public class ItemBLL
{

    public int id { get; set; }
    public string name { get; set; }
    public string name_cat { get; set; }
    public int price { get; set; }
    
    
    //public System.Net.Mime.MediaTypeNames.Image image2 { get; set; }
    public byte[] image2 { get; set; }
    
    public string display { get; set; }
    public string camera { get; set; }
    public string configuration { get; set; }
    public string connectivity { get; set; }
    public string datatranfers { get; set; }
    public string generalfeatures { get; set; }
    public int quantity_id { get; set; }
    public int quantity { get; set; }
    public string image { get; set; }
    public int sale_off { get; set; }
    public int stt { get; set; }
    public int id_cat { get; set; }

    
    public ItemBLL(int id, string name, string namecat,int _id_cat, int price, int quality, string image, byte[] image2, string display, string camera, string confi, string connectivity, string datatra, string general)
    {
        this.id = id;
        this.name = name;
        this.name_cat = namecat;
        this.id_cat = _id_cat;
        this.price = price;
        this.quantity_id = quality;

        this.image = image;
        this.image2 = image2;
        this.display = display;
        this.camera = camera;
        this.configuration = confi;
        this.connectivity = connectivity;

        this.datatranfers = datatra;
        this.generalfeatures = general;
        
    }
    public ItemBLL(int _id, string _name, int _id_cat, int _price, string image,string namecat)
    {
        this.id = _id;
        this.name = _name;
        this.id_cat = _id_cat;
        this.price = _price;
        this.image = image;
        this.name_cat = namecat;
    }
	public ItemBLL()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    //xuất hết sp
    public List<ItemBLL> getAllItemCat()
    {
        return ItemDAL.getAllItems_Cat();
    }
    //xuất trong giỏ
    public List<ItemBLL> getItemCat(int _id_cat)
    {
        return ItemDAL.getItems_Cat(_id_cat);
    }
    public List<ItemBLL> getItemAllCat()
    {
        return ItemDAL.getAllCate();
    }
    public byte[] getImage(string ID)
    {
        return ItemDAL.getImage(ID);
    }
    //xuất thông tin chi tiết
    public List<ItemBLL> getItem_Details(int id)
    {
        return ItemDAL.getItem_Details(id);
    }
    //giỏ
    public List<ItemBLL> getItemInCart(string id)
    {
        return ItemDAL.getItemInCart(id);
    }
    public int getCash(string id)
    {
        return ItemDAL.getCash(id);
    }
    public List<ItemBLL> getSearch(string name)
    {
        return ItemDAL.getSearch(name);
    }
    public bool addItem(ItemBLL it)
    {
        if (ItemDAL.addItem(it))
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    public bool editItem(ItemBLL it)
    {
        if (ItemDAL.editItem(it))
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    public bool delItem(int id)
    {
        if (ItemDAL.delItem(id))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
